package com.bourne.component;

import com.bourne.model.SysRunning;
import com.bourne.util.CommonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

/**
 * @author bourne
 * @Title: SysConf
 * @Description:
 * @date 2022/3/19 - 12:50
 */
@Component
@Slf4j
public class SysConfig implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // log.info("系统启动时加载的自定义类");
    }

    @Bean
    public SysRunning sysRunning() {
        log.info("系统启动时加载的自定义类");
        SysRunning sysRunning = SysRunning.getInstance();
        sysRunning.setStartTime(CommonUtil.getNowDate("yyyy-MM-dd HH:mm:ss"));
        return sysRunning;
    }
}
